<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_JS流程控制</title>
</head>
<body>
<script>
    //1.顺序执行
    console.log(1);
    console.log(2);
    console.log(3);
    //2.分支结构
    let uname='tt';
    if(!uname){
        alert('请先登录');
    }else{
        alert('登录成功'+uname+'欢迎');
    }
    //3.选择分支
    let gender = 10;
    switch(gender){
        case 1:
            console.log('男');
            break;
        case 2:
            console.log('女');
            break;
        default:
            console.log('未知');
    }
    //4.循环结构
    let names = ['tom','jerry','lucy'];
    for(var i=0;i<names.length;i++){
        console.log(names[i]);
    }
    //5.增强for循环
    for(let name of names){
        console.log(name);
    }
</script>
</body>
</html>